<?php

namespace App\Http\Requests\Company;
use Illuminate\Support\Facades\Auth;



class ComboRequest extends BaseRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'title' => 'required|max:120',

        ];
    }

    public function messages()
    {
        return [
            'title.required' => __('请输入专栏课程标题'),
            'title.max' => __('课程标题的长度不能超过:size个字符', ['size' => 120]),
            'short_description.required' => __('请输入专栏的简短介绍'),
        ];
    }

    public function filldata()
    {
        $user  = Auth::user();
        return [
            'user_id'=>(int)$user['app_id'],
            'company_id' =>(int)$user['login_company_id'],
            'chat_id'=>(int) $this->input('chat_id',0),
            'title' => $this->input('title', '标题'),
            'thumb' => $this->input('thumb', ''),
            'category_id'=>$this->input('category_id',''),
            'my_category_id'=>$this->input('my_category_id',''),
            'charge' => $this->input('charge', 0),
            'short_description' => $this->input('short_description', '简短介绍'),
            'description' => $this->input('description', '简短介绍'),
            'is_show' => (int)$this->input('is_show', 1),
            'is_free' => (int)$this->input('is_free', 1),
            'user_count' => (int)$this->input('user_count', 0),
            'images' => (array)$this->input('images', []),
            'video' => (array)$this->input('video'),
            'faqs' => (array)$this->input('faqs', []),
            'target' => (array)$this->input('target',[]),
            'target_audience' => (array)$this->input('target_audience',[]),
            'advantage' => (array)$this->input('advantage',[]),
            'expireds' => $this->input('expireds', []),

        ];
    }

}